class UserSubmission:

    def __init__(self, name, handle, ac_number, total):
        self.name = name
        self.handle = handle
        self.ac_number = ac_number
        self.total = total

    def __lt__(self, other):
        if self.ac_number == other.ac_number:
            return self.total < other.total
        return self.ac_number < other.ac_number

    def to_String(self):
        acRate = 0
        if self.total != 0 :
            acRate = self.ac_number/self.total*100
        message = "name:  " + self.name + "\t" \
                + "handle:  " + self.handle + "\t" \
                + "刷题总数:  " + str(self.ac_number) + "\t"\
                + "总提交数:  " + str(self.total) + "\t" \
                + "通过率:  " +str(acRate) +"% \n"
        return message


